/**
 * Create by CaoWenjian
 *
 * @copyRight: 2018
 **/
package com.bjboot.caocao.common.utils;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 *@Description 获取当前请求中的request，便于aop使用
 *@Author 操文健
 *@Date 2018-09-06 下午8:42
 *@Version 1.0
 **/
public class HttpContextUtils {
    /**
     * 提供静态方法获取当前请求的httpServletRequest
     * @return
     */
    public static HttpServletRequest getHttpServletRequest() {
        return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
    }
}
